package org.yjc.service;

import java.util.List;
import java.util.Optional;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.stereotype.Service;
import org.yjc.entity.Student;
import org.yjc.entity.TbClass;
import org.yjc.repository.TbClassRepository;

@Service
public class TbClassService {
	@Autowired
	private TbClassRepository tbclassDAO;

	public Page<TbClass> findAll(Specification<TbClass> spec, Pageable pageable) {
		return tbclassDAO.findAll(spec, pageable);
	}

	public void save(TbClass tbclass) {
		tbclassDAO.save(tbclass);
	}

	public void deleteById(Integer ids1) {
		tbclassDAO.deleteById(ids1);
		
	}
	
	public List<TbClass> findAll() {
		return tbclassDAO.findAll();
	}

	public TbClass findById(Integer id) {
		Optional<TbClass> optional = tbclassDAO.findById(id);
		if(optional.isPresent()) {
			return optional.get();
		}
		return null;
	}

}
